import time

import pytest

from data_driver.Page.Page_Home import  ProxyHome
from data_driver.Page.Page_Login import PageLogin, ProxyLogin
from data_driver.utils import UtilsDriver, get_msg, get_case_data

data=get_case_data("../case_data/login_case_data.json")
class Test_login:
    def setup_class(self):
        self.proxy_home=ProxyHome()
        self.proxy_login=ProxyLogin()
        self.proxy_home.go_login()

    def setup(self):
        UtilsDriver().get_driver().refresh()

    def teardown_class(self):
        UtilsDriver.quit_driver()

    @pytest.mark.parametrize("username,password,code,expect",data)
    def test_login_01(self,username,password,code,expect):
        self.proxy_login.login_page(username,password,code,expect)
        time.sleep(5)
        message = get_msg()
        time.sleep(2)
        assert expect in message

    # def test_login_02(self):
    #     self.proxy_login.login_page("15837321720", "", "8888")
    #     time.sleep(2)
    #     message=get_msg()
    #     time.sleep(2)
    #     assert "密码不能为空" in message
